package com.mk.admin.controller;

import com.mk.admin.model.ResultDto;
import com.mk.admin.model.query.*;
import com.mk.admin.model.vo.DoctorAreaTimeVo;
import com.mk.admin.model.vo.DoctorSchedulingVo;
import com.mk.admin.model.vo.DoctorVo;
import com.mk.admin.service.DoctorService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/a/adm/doctor")
@Api(tags = "医生(医生，护士，药师)")
public class DoctorController {
    @Autowired
    private DoctorService doctorService;

    @PostMapping("/select")
    public ResultDto select(@RequestBody DoctorQuery query) {
        return doctorService.select(query);
    }


    @PostMapping("/update")
    public ResultDto update(@RequestBody DoctorVo vo) {
        return doctorService.update(vo);
    }

    /**
     * 接诊量更新
     *
     * @param vo
     * @return
     */
    @PostMapping("/serviceNum")
    @ApiOperation(value = "接诊量更新", notes = "只要挂号一次就算")
    public ResultDto serviceNum(@RequestBody DoctorVo vo) {
        return doctorService.serviceNum(vo);
    }

    @PostMapping("/evaluateNum")
    @ApiOperation(value = "评价量更新", notes = "只要评价一次就算，一次只能评价一次")
    public ResultDto evaluateNum(@RequestBody DoctorVo vo) {
        return doctorService.evaluateNum(vo);
    }

    @PostMapping("/likesNum")
    @ApiOperation(value = "关注量更新", notes = "关注量有可能取消关注，所以是对关注进行增加或减少num")
    public ResultDto likesNum(@RequestBody DoctorVo vo) {
        return doctorService.likesNum(vo);
    }

    @PostMapping("/forwardsNum")
    @ApiOperation(value = "转发量更新", notes = "转发一次更新")
    public ResultDto forwardsNum(@RequestBody DoctorVo vo) {
        return doctorService.forwardsNum(vo);
    }

    @PostMapping("/scheduling")
    @ApiOperation(value = "opt_0003排班医生查询", tags = "医生", notes = "排班医生查询")
    public ResultDto selectSchedulingList(@RequestBody DoctorSchedulingVo vo) {
        return doctorService.selectScheduling(vo);
    }

    @PostMapping("/numByCode")
    @ApiOperation(value = "opt_0005根据医生代码获取医生的号源信息", tags = "医生", notes = "根据医生代码获取医生的号源信息")
    public ResultDto numByCode(@RequestBody DoctorNumListQuery query) {
        return doctorService.numByCode(query);
    }

    @PostMapping("/lockNo")
    @ApiOperation(value = "opt_0017锁定号源", tags = "医生", notes = "用户在通过平台选择好医生、就诊日期、就诊时段后，平台通过调用此接口锁定号源")
    public ResultDto lockNo(@RequestBody DoctorLockNoQuery query) {
        return doctorService.lockNo(query);
    }

    @PostMapping("/reserveRegister")
    @ApiOperation(value = "opt_0018门诊预约登记", tags = "医生", notes = "门诊预约")
    public ResultDto reserveRegister(@RequestBody ReserveRegisterQuery query) {
        return doctorService.reserveRegister(query);
    }

    @PostMapping("/reserveCancel")
    @ApiOperation(value = "opt_0019门诊预约取消", tags = "医生", notes = "门诊预约取消  同时对预约号源解锁")
    public ResultDto reserveCancel(@RequestBody ReserveCancelQuery query) {
        return doctorService.reserveCancel(query);
    }

    @PostMapping("/patientHadReserve")
    @ApiOperation(value = "opt_0007门诊已预约信息查询", tags = "医生", notes = "门诊已预约查询")
    public ResultDto patientHadReserve(@RequestBody PatientHadReserveQuery query) {
        return doctorService.patientHadReserve(query);
    }

    @PostMapping("/schedulingAreaTime")
    @ApiOperation(value = "opt_0006根据排班id获取分时段信息", tags = "医生", notes = "根据排班id获取分时段信息")
    public ResultDto selectDepartmentNumList(@RequestBody DoctorAreaTimeVo vo) {
        return doctorService.selectDepartmentNumList(vo);
    }


    @PostMapping("/selectByDeptOrDoctor")
    @ApiOperation(value = "根据科室或者医生进行模糊查询", tags = "医生")
    public ResultDto selectByDeptOrDoctor(@RequestBody DoctorVo vo) {
        return doctorService.selectByDeptOrDoctor(vo);
    }
}
